package com.hsylient.javase.chapter10;

import org.junit.Test;

import java.time.Instant;
import java.time.ZoneOffset;

public class MyInstances {

    @Test
    public void testField() {
        System.out.println(Instant.MAX);
        System.out.println(Instant.MIN);
    }

    @Test
    public void testNow() {
         // 这个是UTC时间（本初子午线的时间，北京时间被这个早八个小时）
        System.out.println(Instant.now());
        System.out.println(Instant.now().atOffset(ZoneOffset.ofHours(8)));
    }

    @Test
    public void testOfEpochSecond() {
        System.out.println(Instant.ofEpochSecond(1656508850L));
        System.out.println(Instant.ofEpochSecond(1656508850L, 111L));
    }

    @Test
    public void testFrom() {
        System.out.println(Instant.from(Instant.MAX));
    }


}
